import { sm4 } from "gm-crypt";

const pwdKey = "cic_gxgl_damei__";

const sm4Config = {
  key: pwdKey,
  mode: "ecb",
  cipherType: "base64",
};

const sm4Util = new sm4(sm4Config);

export function encrypt (text) {
  text = JSON.stringify(text);
  return sm4Util.encrypt(text, pwdKey);
}

export function decrypt (text) {
  return sm4Util.decrypt(text, pwdKey);
}
